package com.xebest.web.controller.homepage;

import com.xebest.web.XeVenBaseTest;
import com.xebest.web.form.XeVenHomeCheckForm;
import org.junit.Test;
import org.springframework.web.client.RestTemplate;

  
/**  
 * @desc: xebest-erp  
 * @author: 李书峰
 * @createTime: 2017年9月15日 下午3:57:28  
 * @history:  
 * @version: v1.0    
 */

public class XeVenPageController extends XeVenBaseTest{
	
	private static String URL_PREFIX_HOME = "http://localhost/home/";
	
	private static String URL_PREFIX_SHOP = "http://localhost/shop/";
	
	//@Test
	public void homeView(){
		try {
			RestTemplate restTemplate = new RestTemplate();
			String retMsg = restTemplate.postForObject(URL_PREFIX_HOME + "/homeView", null, String.class);
			System.out.println(retMsg);
			assertSucces(retMsg);
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
	
	@Test
	public void page(){
		try {
			RestTemplate restTemplate = new RestTemplate();
			String retMsg = restTemplate.postForObject(URL_PREFIX_SHOP + "/page", null, String.class);
			System.out.println(retMsg);
			assertSucces(retMsg);
		} catch (Exception e) {
			e.printStackTrace();
		}
	}

	@Test
	public void getAmountByMonth(){
		try {
			RestTemplate restTemplate = new RestTemplate();
			XeVenHomeCheckForm checkForm = new XeVenHomeCheckForm();
			checkForm.setMonth("09");
			String retMsg = restTemplate.postForObject(URL_PREFIX_HOME + "/getAmountByMonth", checkForm, String.class);
			System.out.println(retMsg);
			assertSucces(retMsg);
		} catch (Exception e) {
			e.printStackTrace();
		}
	}


	@Test
	public void getTotalAmountByMonth(){
		try {
			RestTemplate restTemplate = new RestTemplate();
			String retMsg = restTemplate.postForObject(URL_PREFIX_HOME + "/getTotalAmountByMonth", "09", String.class);
			System.out.println(retMsg);
			assertSucces(retMsg);
		} catch (Exception e) {
			e.printStackTrace();
		}
	}

}
  
